FIO-9350 Wizard: Show form-level errors after failed submission on subsequent form interaction when current page has no errors #5922
+296
−214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-9350
Description
What changed?
setPage()
to display form errors if the form has failed to submit.setPage()
is called when a user clicksdirectly on a Wizard nav link/button, but
onChange()
is not (this bug was fixed foronChange()
by FIO-9360).nextPage()
to check for failed submission; if there has been, display all the form errors. This is necessary for when a user clicks the "next" button without having resolved the error for that page. It causes validation to trigger for the current page only and wipes the other form errors.get errors()
a.k.a.this.errors
to grab the form-level errors if the form previously failed to submit. Whilethis.showErrors()
displayed the errors correctly, while testing I discovered that the errors were wiped incorrectly from the Wizard instance in this scenario andthis.errors
fell back to only returning errors for the current page.Why have you chosen this solution?
Basically, we check if the form has previously submitted (indicating a failed submission). If it has, we show all the form
errors on every page until they are resolved individually on each page, as opposed to only validating the current page.
FIO-9360 did this
onChange()
, but not forsetPage()
andnextPage()
.Breaking Changes / Backwards Compatibility
n/a
Dependencies
n/a
How has this PR been tested?
Automated and manual. I de-duped up one of commonly-used helper functions in the Wizard tests and made it a global helper at the top of the Wizard tests. I also updated the async syntax for a flaky test to aid in potential future debugging.
Checklist: